package com.campus.customer.controller;

import com.campus.customer.entity.Location;
import com.campus.customer.service.LocationService;
import com.campus.common.bean.common.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 位置表 前端控制器
 * </p>
 *
 * @author ZhaoYuJie
 * @since 2025-04-02
 */
@Api(tags = "位置管理接口")
@RestController
@RequestMapping("/location")
public class LocationController {
    @Autowired
    private LocationService locationService;

    @ApiOperation("获取位置列表")
    @GetMapping("/list")
    public Resp<List<Location>> list() {
        return Resp.success(locationService.list());
    }

    @ApiOperation("获取校园中心位置配置")
    @GetMapping("/campus-center")
    public Resp<Location> getCampusCenter() {
        Location campusCenter = locationService.getCampusCenter();
        return Resp.success(campusCenter);
    }
}
